package ORG.csmz;

class person{
    String name;
    int age;
    public void eat(){
        System.out.println("吃饭");
    }
    public void sleep(){
        System.out.println("睡觉");
    }
}
class  Student extends person{
    public void study(){
        System.out.println("学习");
    }
}
class Teacher extends person{
    int salary;
    public void teach(){
        System.out.println("教书");
    }
}
public class Example01 {
    public static void main (String[] args){
        Student student =new Student();
        student.name="张三";
        student.age=16;
        System.out.print("我叫"+student.name+"，我今年"+student.age+"岁。");
        System.out.println("我可执行如下方法");
        student.eat();
        student.sleep();
        student.study();
        Teacher teacher=new Teacher();
        teacher.name="李四";
        teacher.age=30;
        teacher.salary=5000;
        System.out.print("我叫"+teacher.name+"我今年"+teacher.age+"岁,"+"我的薪资是"+teacher.salary+"元/月");
        System.out.println("我可执行如下方法");
        teacher.eat();
        teacher.sleep();
        teacher.teach();
    }
}
